package com.google.android.material.datepicker;

import android.os.Parcel;
import android.os.Parcelable;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;

final class l implements Comparable<l>, Parcelable {
    public static final Parcelable.Creator<l> CREATOR = new a();

    /* renamed from: b  reason: collision with root package name */
    private final Calendar f2263b;

    /* renamed from: c  reason: collision with root package name */
    private final String f2264c = r.n().format(this.f2263b.getTime());

    /* renamed from: d  reason: collision with root package name */
    final int f2265d;
    final int e = this.f2263b.get(1);
    final int f = this.f2263b.getMaximum(7);
    final int g = this.f2263b.getActualMaximum(5);
    final long h = this.f2263b.getTimeInMillis();

    static class a implements Parcelable.Creator<l> {
        a() {
        }

        /* renamed from: a */
        public l createFromParcel(Parcel parcel) {
            return l.k(parcel.readInt(), parcel.readInt());
        }

        /* renamed from: b */
        public l[] newArray(int i) {
            return new l[i];
        }
    }

    private l(Calendar calendar) {
        calendar.set(5, 1);
        Calendar d2 = r.d(calendar);
        this.f2263b = d2;
        this.f2265d = d2.get(2);
    }

    static l k(int i, int i2) {
        Calendar k = r.k();
        k.set(1, i);
        k.set(2, i2);
        return new l(k);
    }

    static l l(long j) {
        Calendar k = r.k();
        k.setTimeInMillis(j);
        return new l(k);
    }

    static l s() {
        return new l(r.i());
    }

    public int describeContents() {
        return 0;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof l)) {
            return false;
        }
        l lVar = (l) obj;
        return this.f2265d == lVar.f2265d && this.e == lVar.e;
    }

    public int hashCode() {
        return Arrays.hashCode(new Object[]{Integer.valueOf(this.f2265d), Integer.valueOf(this.e)});
    }

    /* renamed from: j */
    public int compareTo(l lVar) {
        return this.f2263b.compareTo(lVar.f2263b);
    }

    /* access modifiers changed from: package-private */
    public int m() {
        int firstDayOfWeek = this.f2263b.get(7) - this.f2263b.getFirstDayOfWeek();
        return firstDayOfWeek < 0 ? firstDayOfWeek + this.f : firstDayOfWeek;
    }

    /* access modifiers changed from: package-private */
    public long n(int i) {
        Calendar d2 = r.d(this.f2263b);
        d2.set(5, i);
        return d2.getTimeInMillis();
    }

    /* access modifiers changed from: package-private */
    public String o() {
        return this.f2264c;
    }

    /* access modifiers changed from: package-private */
    public long p() {
        return this.f2263b.getTimeInMillis();
    }

    /* access modifiers changed from: package-private */
    public l q(int i) {
        Calendar d2 = r.d(this.f2263b);
        d2.add(2, i);
        return new l(d2);
    }

    /* access modifiers changed from: package-private */
    public int r(l lVar) {
        if (this.f2263b instanceof GregorianCalendar) {
            return ((lVar.e - this.e) * 12) + (lVar.f2265d - this.f2265d);
        }
        throw new IllegalArgumentException("Only Gregorian calendars are supported.");
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.e);
        parcel.writeInt(this.f2265d);
    }
}
